package com.ganee.agora.repository

import com.ganee.agora.api.LoginApiService
import com.ganee.agora.model.LoginEntity
import com.ganee.baselib.httprequest.callback.RequestCallback
import com.ganee.baselib.mvvmlibrary.base.BaseRepository
import com.ganee.baselib.mvvmlibrary.base.BaseViewModel

import okhttp3.RequestBody

class LoginRepository(baseViewModel: BaseViewModel<*>) : BaseRepository(baseViewModel) {

    /**
     * 请求接口-登录
     */
    fun postLogin(body: RequestBody, callback: RequestCallback<LoginEntity>) {
        execute(getApi(LoginApiService::class.java).postLogin(body), callback)
    }

    /**
     * 请求接口-登录
     */
    fun login(body: RequestBody, callback: RequestCallback<String>) {
        execute(getApi(LoginApiService::class.java).login(body), callback)
    }

    /**
     * 请求接口-注册
     */
    fun register(body: RequestBody,callback: RequestCallback<Any>) {
        executeQuietly(getApi(LoginApiService::class.java).postRegister(body),callback)
    }
}
